package upm.pb4agent.team5.util;

import java.io.FileInputStream;
import java.net.URL;
import java.util.Properties;

public class ConfigFile {
	private static final String FILE_NAME = "upm/pb4agent/config.properties";
	private static Properties prop = null;
	private static URL url = null;
	
	static {
		url = ConfigFile.class.getProtectionDomain().getCodeSource().getLocation(); // Default: file:/home/rodolfo/workspace/PB-4/bin/
		prop = new Properties();
        try {
            prop.load(new FileInputStream(url.getFile() + FILE_NAME));
        } catch (Exception e) {
        	System.err.println("Error reading config.properties file: " + e.getMessage());
        }
	}
	
	public static String getProperty(String name) {
        return prop.getProperty(name);
	}
	
	public static void main(String[] args) {
		System.out.println(getProperty("rower1_strength"));
	}
}
